import { getCateList as getCateListApi } from '@/api/cate'
import { onMounted, ref } from 'vue'

const columns = [
  {
    name: 'Name',
    dataIndex: 'name',
    key: 'name'
  },
  {
    title: '排序',
    dataIndex: 'sort',
    key: 'sort'
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status'
  },
  {
    title: '操作',
    key: 'action'
  }
]

const cateData = ref<any[]>([])

function getCateList() {
  getCateListApi().then((res: any) => {
    cateData.value = res
  })
}

export default function () {
  onMounted(() => {
    getCateList()
  })

  return {
    cateData,
    columns,
    getCateList
  }
}
